<%--
  Created by IntelliJ IDEA.
  User: 陈俊雄
  Date: 2018/6/14
  Time: 14:38
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<style type="text/css">
    .img-size {
        height: 136px;
        width: 136px;
    }

    .a-upload {
        text-align: center;
        line-height: 128px;
        position: relative;
        cursor: pointer;
        color: #888;
        background: #f2f2f2;
        border: 1px solid #ddd;
        /*overflow: hidden;*/
        display: inline-block;
        *display: inline;
        *zoom: 1
    }

    .a-upload input {
        width: 136px;
        height: 136px;
        position: absolute;
        /*font-size: 100px;*/
        left: 0;
        top: 0;
        opacity: 0;
        cursor: pointer
    }

    .a-upload:hover {
        color: #444;
        background: #eee;
        border-color: #ccc;
        text-decoration: none
    }
</style>
<!-- Main view -->
<div class="animated fadeInRight">
    <div class="wrapper wrapper-content ng-scope" ng-controller="merchantInfoCtrl">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{goType == null ? 'MERCHANT_ADD' : 'MERCHANT_INFO' | translate}}</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="sk-spinner sk-spinner-wave">
                            <div class="sk-rect1"></div>
                            <div class="sk-rect2"></div>
                            <div class="sk-rect3"></div>
                            <div class="sk-rect4"></div>
                            <div class="sk-rect5"></div>
                        </div>
                        <form name="myForm" class="form-horizontal">
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>商户号：</label>
                                <div class="col-lg-1">
                                    <input type="text" class="form-control input-sm"
                                           name="merId"
                                           maxlength="9"
                                           oninput="inputRegex(this, /\D/g)"
                                           ng-model="merchant.merchantInfo.id"
                                           ng-blur="merIdBlur($event, merchant.merchantInfo.id)"
                                           ng-disabled="goType != null"
                                           required>
                                </div>
                                <div class="p-xxs" ng-show="isExist"><span class="text-danger">商户号已存在</span></div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>姓名：</label>
                                <div class="col-lg-2">
                                    <input type="text" class="form-control input-sm"
                                           name="merName"
                                           maxlength="50"
                                           oninput="inputRegex(this, /[^()-\u4e00-\u9fa5\w]/g)"
                                           ng-model="merchant.merchantInfo.name"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>商户类型：</label>
                                <div class="col-lg-2">
                                    <select class="form-control b-r-sm"
                                            name="category"
                                            ng-model="merchant.merchantInfo.category"
                                            ng-options="+(x.firstValue) as x.name for x in merchantCategory"
                                            required>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>省份：</label>
                                <div class="col-lg-2">
                                    <select class="form-control b-r-sm"
                                            name="province"
                                            ng-model="merchant.merchantInfo.province"
                                            ng-change="provinceChange()"
                                            ng-options="x.id as x.name for x in provinceInfo"
                                            required>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>城市：</label>
                                <div class="col-lg-2">
                                    <select class="form-control b-r-sm"
                                            name="city"
                                            ng-model="merchant.merchantInfo.city"
                                            ng-change="cityChange()"
                                            ng-disabled="merchant.merchantInfo.province == null || cityInfo == null"
                                            ng-options="x.id as x.name for x in cityInfo"
                                            required>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>区县：</label>
                                <div class="col-lg-2">
                                    <select class="form-control b-r-sm"
                                            name="area"
                                            ng-model="merchant.merchantInfo.area"
                                            ng-disabled="merchant.merchantInfo.city == null || areaInfo == null"
                                            ng-options="x.id as x.name for x in areaInfo"
                                            required>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>详细地址：</label>
                                <div class="col-lg-4">
                                    <input type="text" class="form-control input-sm"
                                           name="address"
                                           maxlength="200"
                                           ng-model="merchant.merchantInfo.address"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>联系人：</label>
                                <div class="col-lg-2">
                                    <input type="text" class="form-control input-sm"
                                           name="contacts"
                                           maxlength="50"
                                           ng-model="merchant.merchantInfo.contacts"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>电话：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           name="phone"
                                           maxlength="50"
                                           oninput="inputRegex(this, /[^*()+\-\d]/g)"
                                           ng-model="merchant.merchantInfo.phone"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>联系邮箱：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           name="email"
                                           maxlength="50"
                                           ng-model="merchant.merchantInfo.email"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>传真：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           name="fax"
                                           maxlength="50"
                                           oninput="inputRegex(this, /[^*()+\-\d]/g)"
                                           ng-model="merchant.merchantInfo.fax"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>QQ：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           name="qq"
                                           maxlength="20"
                                           oninput="inputRegex(this, /\D/g)"
                                           ng-model="merchant.merchantInfo.qq">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">邮箱：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           maxlength="50"
                                           ng-model="merchant.merchantPay.email">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>证件：</label>
                                <div class="col-lg-10">
                                    <!-- The Gallery as lightbox dialog, should be a child element of the document body -->
                                    <div id="blueimp-gallery" class="blueimp-gallery">
                                        <div class="slides"></div>
                                        <h3 class="title"></h3>
                                        <a class="prev">‹</a>
                                        <a class="next">›</a>
                                        <a class="close">×</a>
                                        <a class="play-pause"></a>
                                        <ol class="indicator"></ol>
                                    </div>
                                    <div>
                                        <a ng-repeat="x in certificateImgUrl"
                                           href="/merchant/certificateImg?certificate={{x}}" data-gallery="">
                                            <img ng-src="{{'/merchant/certificateImg?certificate='+x}}"
                                                 class="img-size">
                                        </a>
                                        <a href="javascript:" class="a-upload img-size">
                                            <input type="file" nv-file-select="" uploader="uploader" multiple
                                                   ng-disabled="merchant.merchantInfo.id==null"
                                                   accept="image/*">上传证件
                                        </a>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>业务员：</label>
                                <div class="col-lg-2">
                                    <input type="text" class="form-control input-sm"
                                           name="salesman"
                                           maxlength="50"
                                           ng-model="merchant.merchantSetting.salesmanName"
                                           required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>业务类型：</label>
                                <div class="col-lg-3">
                                    <select class="form-control b-r-sm"
                                            name="refType"
                                            ng-model="merchant.merchantSetting.refType"
                                            ng-options="x.firstValue as x.name for x in businessType"
                                            required>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>合同开始时间：</label>
                                <div class="col-lg-3">
                                    <div class="input-group m-b">
                                    <input type="text" name="startDate"
                                           class="form-control" ng-readonly="true" ng-click="openDatepicker1()"
                                           uib-datepicker-popup="{{format}}"
                                           ng-model="merchant.merchantSetting.startTime"
                                           is-open="popup1.opend"
                                           datepicker-options="dateOptions1"
                                           alt-input-formats="altInputFormats"
                                           close-text="关闭" clear-text="清空" current-text="今天" required>
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-default no-margins"
                                                ng-click="openDatepicker1()">
                                            <i class="fa fa-calendar"></i>
                                        </button>
                                    </span>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg-2 control-label"><span class="text-danger">*</span>合同结束时间：</label>
                                <div class="col-lg-3">
                                    <div class="input-group m-b">
                                    <input type="text" name="endDate"
                                           class="form-control" ng-readonly="true" ng-click="openDatepicker2()"
                                           uib-datepicker-popup="{{format}}"
                                           ng-model="merchant.merchantSetting.endTime"
                                           is-open="popup2.opend"
                                           datepicker-options="dateOptions2"
                                           alt-input-formats="altInputFormats"
                                           close-text="关闭" clear-text="清空" current-text="今天" required>
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-default no-margins"
                                                ng-click="openDatepicker2()">
                                            <i class="fa fa-calendar"></i>
                                        </button>
                                    </span>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group" ng-show="goType == 1">
                                <label class="col-lg-2 control-label">创建人：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           value="{{merchant.merchantInfo.creator}}" disabled>
                                </div>
                            </div>
                            <div class="form-group" ng-show="goType == 1">
                                <label class="col-lg-2 control-label">创建时间：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           value="{{merchant.merchantInfo.createTime | date:'yyyy/MM/dd hh:mm'}}"
                                           disabled>
                                </div>
                            </div>
                            <div class="form-group" ng-show="goType == 1">
                                <label class="col-lg-2 control-label">修改人：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           value="{{merchant.merchantInfo.modifier}}" disabled>
                                </div>
                            </div>
                            <div class="form-group" ng-show="goType == 1">
                                <label class="col-lg-2 control-label">修改时间：</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control input-sm"
                                           value="{{merchant.merchantInfo.modifyTime | date:'yyyy/MM/dd hh:mm'}}"
                                           disabled>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-lg-6 center">
                                    <button class="btn btn-sm"
                                            ng-class="{'btn-primary' : goType == null, 'btn-success' : goType == 1}"
                                            type="button" ng-click="confirm()"
                                            ng-disabled="confirmDisabled(myForm)">
                                        {{goType == null ? '下一步' : '确定'}}
                                    </button>
                                    <button class="btn btn-sm btn-info" type="button" ng-click="cancel()">
                                        取消
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
